package com.taco.springcloud.generate.model.dto;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 分页参数
 *
 * @author Yu
 * @date 2019/10/19 22:09
 **/

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "分页对象")
public class PageDTO implements Serializable {

    private static final long serialVersionUID = -2971668720344937755L;

    /**
     * 当前页数
     */
    @ApiModelProperty(value = "当前页数（默认值：1）", example = "1")
    private Long currentPage = 1L;

    /**
     * 一页的数量
     */
    @ApiModelProperty(value = "一页的数量（默认值：10）", example = "10")
    private Long pageSize = 10L;

    public <E> Page<E> buildQueryPage() {
        return new Page<>(currentPage, pageSize);
    }

}
